#! /usr/bin/perl
use strict;

# usage: perl isWinTest.pl /path/to/isWinExecutable /path/to/vectors.red.lst

my ($isWinExec, $testFile) = @ARGV;
print "isWin = $isWinExec, testFile = $testFile\n";

open (VECTORS, $testFile);
my $passed;
my $count;
my $rv;

while (<VECTORS>) {
    ++$count;
    chomp $_;
    my ($vect, $expWinVal) = split ' ';
    $rv = `echo '$vect' | $isWinExec`;
    chomp $rv;
    if ($rv == $expWinVal) {
        $passed++;
    } else {
        print "$count: FAIL -- Vector was:\n$vect\nExpected: $expWinVal\nGot: $rv\n";
    }
    print "$count\n" if (!($count % 100));
}
print "$passed/10200 passed\n";

